package indi.zhifa.study2024.class002.busy.generalTest.business.curd.inv.storage.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import indi.zhifa.study2024.class002.busy.generalTest.business.curd.inv.storage.entity.po.ItemInventoryEntity;
import indi.zhifa.study2024.class002.busy.generalTest.business.curd.inv.storage.dao.mapper.ItemInventoryMapper;
import indi.zhifa.study2024.class002.busy.generalTest.business.curd.inv.storage.dao.service.IItemInventoryDbService;
import indi.zhifa.study2024.core.mpenhence.entity.annotations.ZfDbService;
import indi.zhifa.study2024.core.mpenhence.service.impl.ZfDbServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品库存表 服务实现类
 * </p>
 *
 * @author 织法
 * @since 2024-09-19
 */
@ZfDbService(name="ItemInventoryEntity")
public class ItemInventoryDbServiceImpl extends ZfDbServiceImpl<ItemInventoryMapper, ItemInventoryEntity> implements IItemInventoryDbService {

    @Override
    public ItemInventoryEntity findByItemId(Long pItemId) {
        LambdaQueryWrapper<ItemInventoryEntity> queryWrapper = Wrappers.<ItemInventoryEntity>lambdaQuery()
                .eq(ItemInventoryEntity::getItemId, pItemId);
        return findOne(queryWrapper);
    }

    @Override
    public List<ItemInventoryEntity> listByItemIdList(List<Long> pItemIdList) {

        LambdaQueryWrapper<ItemInventoryEntity> queryWrapper = Wrappers.<ItemInventoryEntity>lambdaQuery()
                .in(ItemInventoryEntity::getItemId, pItemIdList);

        return list(queryWrapper);
    }
}
